/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is Forte for Java, Community Edition. The Initial
* Developer of the Original Code is Sun Microsystems, Inc. Portions
* Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.javadoc.comments;
import org.openide.src.MemberElement;
import org.openide.src.JavaDocTag;
import org.openide.src.JavaDocSupport;
/**
*
* @author
* @version
*/
public class SeeTagPanel extends TagPanel {
private static final String cardName = "CRD_SEE"; // NOI18N
static final long serialVersionUID =-6495497486819375562L;
/** Initializes the Form */
public SeeTagPanel( MemberElement element, JavaDocEditorPanel editorPanel ) {
super( editorPanel );
initComponents ();
editorPanel.registerComponent( descriptionTextArea );
addHTMLComponent( descriptionTextArea );
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents () {//GEN-BEGIN:initComponents
setLayout (new java.awt.GridBagLayout ());
java.awt.GridBagConstraints gridBagConstraints1;
jLabel2 = new javax.swing.JLabel ();
jLabel2.setText (org.openide.util.NbBundle.getBundle(SeeTagPanel.class).getString("CTL_SeeTagPanel.jLabel2.text"));
jLabel2.setHorizontalAlignment (javax.swing.SwingConstants.LEFT);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 1);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (jLabel2, gridBagConstraints1);
classTextField = new javax.swing.JTextField ();
classTextField.setText ("jTextField1"); // NOI18N
classTextField.setEditable (false);
classTextField.setEnabled (false);
classTextField.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
nameTextFieldActionPerformed (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (2, 1, 2, 2);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (classTextField, gridBagConstraints1);
jLabel3 = new javax.swing.JLabel ();
jLabel3.setText (org.openide.util.NbBundle.getBundle(SeeTagPanel.class).getString("CTL_SeeTagPanel.jLabel3.text"));
jLabel3.setHorizontalAlignment (javax.swing.SwingConstants.LEFT);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 1);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (jLabel3, gridBagConstraints1);
memberTextField = new javax.swing.JTextField ();
memberTextField.setText ("jTextField2"); // NOI18N
memberTextField.setEditable (false);
memberTextField.setEnabled (false);
memberTextField.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
typeTextFieldActionPerformed (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (2, 1, 2, 2);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (memberTextField, gridBagConstraints1);
jLabel1 = new javax.swing.JLabel ();
jLabel1.setText (org.openide.util.NbBundle.getBundle(SeeTagPanel.class).getString("CTL_SeeTagPanel.jLabel1.text"));
jLabel1.setHorizontalAlignment (javax.swing.SwingConstants.LEFT);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 1);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
add (jLabel1, gridBagConstraints1);
descriptionScrollPane = new javax.swing.JScrollPane ();
descriptionTextArea = new javax.swing.JEditorPane ();
descriptionTextArea.setContentType ("text/html"); // NOI18N
descriptionTextArea.addFocusListener (new java.awt.event.FocusAdapter () {
public void focusGained (java.awt.event.FocusEvent evt) {
descriptionTextAreaFocusGained (evt);
}
public void focusLost (java.awt.event.FocusEvent evt) {
descriptionTextAreaFocusLost (evt);
}
}
);
descriptionScrollPane.setViewportView (descriptionTextArea);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.gridheight = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints1.insets = new java.awt.Insets (2, 1, 2, 2);
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.weighty = 1.0;
add (descriptionScrollPane, gridBagConstraints1);
}//GEN-END:initComponents
private void descriptionTextAreaFocusGained (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTextAreaFocusGained
enableHTMLButtons( true );
}//GEN-LAST:event_descriptionTextAreaFocusGained
private void descriptionTextAreaFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTextAreaFocusLost
enableHTMLButtons( false );
commitTagChange();
}//GEN-LAST:event_descriptionTextAreaFocusLost
private void nameTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameTextFieldActionPerformed
// Add your handling code here:
}//GEN-LAST:event_nameTextFieldActionPerformed
private void typeTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeTextFieldActionPerformed
// Add your handling code here:
}//GEN-LAST:event_typeTextFieldActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField classTextField;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField memberTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JEditorPane descriptionTextArea;
// End of variables declaration//GEN-END:variables
void setData( JavaDocTag tag ) {
descriptionTextArea.setText( tag.text() );
descriptionTextArea.setCaretPosition( 0 );
classTextField.setText( ((JavaDocTag.See)tag).referencedClassName() );
memberTextField.setText( ((JavaDocTag.See)tag).referencedMemberName() );
}
JavaDocTag getTag( String tagName ) {
return JavaDocSupport.createSeeTag( tagName,
descriptionTextArea.getText() );
};
String getCardName() {
return cardName;
}
void grabFirstFocus() {
classTextField.grabFocus();
}
}
/*
* Log
* 8 Gandalf 1.7 1/12/00 Petr Hrebejk i18n
* 7 Gandalf 1.6 1/3/00 Petr Hrebejk Various bugfixes - 4709,
* 4978, 5017, 4981, 4976, 5016, 4740, 5005
* 6 Gandalf 1.5 11/27/99 Patrik Knakal
* 5 Gandalf 1.4 11/10/99 Petr Hrebejk Workaround for catching
* the mnemonics of HTML tag buttons
* 4 Gandalf 1.3 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun
* Microsystems Copyright in File Comment
* 3 Gandalf 1.2 9/16/99 Petr Hrebejk Tag descriptions editing
* in HTML editor + localization
* 2 Gandalf 1.1 8/13/99 Petr Hrebejk Window serialization
* added & Tag change button in Jdoc editor removed
* 1 Gandalf 1.0 7/9/99 Petr Hrebejk
* $
*/